package com.jwt.demo.service.impl;

import com.jwt.demo.domain.User;
import com.jwt.demo.service.UsersTokenService;
import com.jwt.demo.util.RedisUtil;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service("AdminTokenService")
public class UsersTokenServiceImpl implements UsersTokenService {

    @Resource
    private RedisUtil redisUtil;

    @Override
    public User getUsersByid(String token) {
        Object object = redisUtil.getCacheObject(token);
        if (object == null) {
            return null;
        } else {
            return (User) object;
        }


    }
}
